<?xml version="1.0" encoding="UTF-8"?>


<!--
	main-nutella.xsl

	Foglio di stile XML -> XHTML principale.

	Compatibile con layout-1.css e layout-2.css
-->


<xsl:stylesheet
	version = "1.0"
	xmlns = "http://www.w3.org/1999/xhtml"
	xmlns:inc = "http://ltw0807.web.cs.unibo.it/xsl/inc"
	xmlns:xsl = "http://www.w3.org/1999/XSL/Transform">


	<!--
		Inclusione template.
	-->
	<xsl:include href = "inc/xhtml.inc.xsl"/>
	<xsl:include href = "inc/special.inc.xsl"/>
	<xsl:include href = "inc/errore.inc.xsl"/>
	<xsl:include href = "inc/response.inc.xsl"/>
	<xsl:include href = "inc/scheda.inc.xsl"/>
	<xsl:include href = "inc/fragment.inc.xsl"/>
	<xsl:include href = "inc/document.inc.xsl"/>


	<xsl:output
		method = "xml"
		version = "1.0"
		encoding = "UTF-8"
		indent = "yes"
		doctype-public = "-//W3C//DTD XHTML 1.1//EN"
		doctype-system = "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
		media-type = "application/xhtml+xml"/>


	<!--
		Parametri ricevuti da PHP.

		- type deve essere 'fragment' o 'document'
		- layout-url e skin-ulr devono essere gli URL assoluti ai file CSS.
	-->
	<xsl:param name = "type"/>
	<xsl:param name = "layout-url"/>
	<xsl:param name = "skin-url"/>


	<!--
		Template match /

		chiama il template 'inc:fragment' o 'inc:document'
	-->
	<xsl:template match = "/">
		<xsl:choose>
			<xsl:when test = "$type = 'fragment'">
				<xsl:call-template name = "inc:fragment"/>
			</xsl:when>
			<xsl:when test = "$type = 'document'">
				<xsl:call-template name = "inc:document"/>
			</xsl:when>
		</xsl:choose>
	</xsl:template>


	<!--
		Template match *

		ricrea l'elemento e i suoi attributi scartando namespace e prefisso.
	-->
	<xsl:template match="*">
		<xsl:element name="{local-name()}">
			<xsl:copy-of select="@*"/>
			<xsl:apply-templates/>
		</xsl:element>
	</xsl:template>

</xsl:stylesheet>
